package main

import (
	"mars-backend/routers"

	"github.com/astaxie/beego"
	"github.com/astaxie/beego/plugins/cors"
)

func main() {
	beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
		AllowAllOrigins:  true,
		AllowMethods:     []string{"DELETE", "PUT", "POST", "GET", "OPTIONS", "*"},
		AllowHeaders:     []string{"Origin", "Authorization", "Access-Control-Allow-Origin", "Content-Type"},
		ExposeHeaders:    []string{"Content-Length", "Access-Control-Allow-Origin"},
		AllowCredentials: true,
	}))
	routers.MailRouter()
	routers.LoginRouter()
	routers.AdminRouter()
	routers.UserRouter()
	
	beego.Run()
}
